package org.gatorojo.dao.connection;

import java.util.ResourceBundle;
import org.gatorojo.exception.GatoRojoException;

public class ConnectionProperties {
	
	private static final String propertiesFile = "connection";
	private static ResourceBundle bundle;	

	static {
		bundle = ResourceBundle.getBundle(propertiesFile);			
	}

	public static String getProperty(String key, boolean mandatory)
			throws GatoRojoException {
		String property = bundle.getString(key);
		if(mandatory)
			if(property == null || property.trim().length() == 0)
				throw new GatoRojoException("The property '" + key + "'" + " is mandatory!");
		return property;
	}
}